<template>
  <a-drawer :title="`货箱`" width="70%" :visible="visible"
            hide-cancel
            @cancel="visible = false"
            :footer="false"
            v-if="visible">
    <ma-crud ref="crudRef" :columns="columns" :options="shipmentOptions" :scrollbar="true">

    </ma-crud>
  </a-drawer>
</template>
<script setup>

import {computed, inject, ref,reactive,h} from "vue";
import parcel from "@/api/document/parcel.js";
import dictHelp from "@/utils/dicthelp.js";
const crudRef = ref()
const parentCrudRef = inject('crudRef')
const getRecord = inject('getRecord')
const record = inject('record')
const changeStatus = ref(0)

const selected = computed(() => crudRef.value?.selecteds)
const visible = defineModel()
const shipmentOptions = ref({
  rowSelection: {showCheckedAll: false},
  showTools: true,
  // pageLayout: 'fixed',
  // 默认统一设置列宽度
  columnWidth: 0,
  expandSearch:false,
  contextMenu: {
    // 是否开启右键菜单
    enabled: false,
  },
  pageSize:20,
  // tableLayoutFixed: true,
  pk: 'parcel_id',
  api: parcel.viewParcelDeclaration,
  requestParams: {
    parcel:1,
    waybill_id: record.value.id,
  }
})

const columns = reactive([
  // {
  //     title: "提单号",
  //     dataIndex: "parcel.waybill.waybill_id",
  //     formType: "input",
  // },
  {
      title: "所属用户",
      dataIndex: "parcel.shipment.user_id",
      formType: "select",
      dict:dictHelp.customer
  },
  {
      title: "运单号",
      dataIndex: "parcel.shipment.shipment_no",
      formType: "input",
  },
  {
      title: "箱号",
      dataIndex: "parcel.number",
      formType: "input",
  },
  {
      title: "商品SKU",
      dataIndex: "sku",
      formType: "input",
  },
  {
      title: "PO Number",
      dataIndex: "po_number",
      formType: "input",
  },
  {
      title: "中文品名",
      dataIndex: "cn_name",
      formType: "input",
  },
  {
      title: "英文品名",
      dataIndex: "en_name",
      formType: "input",
  },
  {
      title: "申报单价",
      dataIndex: "price",
      formType: "input",
  },
  {
      title: "数量",
      dataIndex: "quantity",
      formType: "input",
  },
  {
      title: "材质",
      dataIndex: "material",
      formType: "input",
  },
  {
      title: "用途",
      dataIndex: "purpose",
      formType: "input",
  },
  {
      title: "品牌",
      dataIndex: "brand",
      formType: "input",
  },
  {
      title: "销售链接",
      dataIndex: "sale_url",
      formType: "input",
  },
])
</script>